﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ContentPlaceHolderID="ScriptContent" runat="server">

	<script language="javascript" type="text/javascript">
		$(function ()
		{
			$.ajaxSetup({ cache: false });

			$("#formTarget").text("Loading....");

			// wait 1.5 seconds to demonstrate this is loading via ajax
			setTimeout(function ()
			{
				// load the form fragment
				$("#formTarget").load("/AjaxForm/FormFragment", null, null);
			}, 1500);
		});

	</script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

	<h2>AJAX FORM</h2>

	<p>This example will validation client and server side. A custom validation executes on the server side, so try making the client validation pass, but 
	in the author field, specify Tony Johnson as the author - this will fail server side validation. In addition this demonstrates the use of a custom client
	and server side validator - enter Bill Gates as the author to see this trigger client side or enter Richard Branson to see it trigger server side.</p>

	<p>The key difference here is the form is loaded using an ajax request into the div following this paragraph :)</p>

	<div id="formTarget">
	</div>

</asp:Content>
